package IC.Parser;

public class LexicalError extends Exception {
	private int line; // line number
	private String message; // error message
	private String value; // value caused error
	
    public LexicalError(String message) {
     super(message);
     this.message= message;
    }
    
    public LexicalError(int line, String message, String value) {
        super(message);
        this.line = line+1;
        this.message = message;
        this.value = value;
       }
    public String toString() {
    	// return "LINE: ERROR_MESSAGE" and "(VALUE)" if there is a value 
        return this.line + ": " + "Lexical error: " + this.message + ((this.value != null)? (" '" + this.value + "'") : "");
    }
}
